/*
*  Copyright (C) 2013 Michael Mallat michael.mallat@gmail.com
*
*  This file is part of MyTribbles
*
*  MyTribbles is free software: you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation, either version 3 of the License, or
*  (at your option) any later version.
*
*  MyTribbles is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with MyTribbles.  If not, see <http://www.gnu.org/licenses/>.
*/


#ifndef _FIELD_H_
#define _FIELD_H_

#include <iostream>
#include <string>
#include <list>

#include "tribble.h"

class Field
{
    public:

        Field()
        {
            this->bFood = false;
            this->nX = -1;
            this->nY = -1;
        }

        Field(int nX, int nY)
        {
            Field();
            this->nX = nX;
            this->nY = nY;
        }
        
        void setFood(bool bFood)
        {
            this->bFood = bFood;
        }
        
        void setCoords(int nX, int nY)
        {
            this->nX = nX;
            this->nY = nY;
        }
        
        int getNumberOfTribbles() const
        {
            return this->FieldTribbleList.size();
        }

        void addTribble(Tribble *t)
        {
            this->FieldTribbleList.push_back(t);
        }
        
        void clearTribbles()
        {
            this->FieldTribbleList.clear();
        }
        
        std::list<Tribble*>::iterator getIteratorBegin() 
        {
            return FieldTribbleList.begin();
        }

        std::list<Tribble*>::iterator getIteratorEnd() 
        {
            return FieldTribbleList.end();
        }

        bool isFood() const
        {
           return bFood;
        }
        
        int getX() const
        {
            return nX;
        }

        int getY() const
        {
            return nY;
        }

    private:
        int nX;
        int nY;
        bool bFood;
        std::list<Tribble*> FieldTribbleList;
        std::list<Tribble*>::iterator FieldTribbleListIterator;
};


#endif
